package r5.powtorka6;

public class Manager extends Employee {

	private double bonus;

	public Manager(String name, int year, int month, int day, double salary) {
		super(name, year, month, day, salary);
		this.bonus = 0;
	}

	public double getBonus() {
		return bonus;
	}

	public void setBonus(double bonus) {
		this.bonus = bonus;
	}

	@Override
	public double getSalary() {
		return super.getSalary() + this.bonus;
	}

	@Override
	public String toString() {
		return super.toString() + ", " + walutaFormatka.format(this.bonus);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		long temp;
		temp = Double.doubleToLongBits(bonus);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Manager other = (Manager) obj;
		if (Double.doubleToLongBits(bonus) != Double
				.doubleToLongBits(other.bonus))
			return false;
		return true;
	}

}
